package xyz.hubery.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.hubery.domain.TurnoverOrder;
import xyz.hubery.model.R;
import xyz.hubery.service.TurnoverOrderService;

@RestController
@RequestMapping("/turnoverOrders")
@Api(tags = "成交订单")
public class TurnoverOrderController {

    @Autowired
    private TurnoverOrderService turnoverOrderService;


    @GetMapping
    @ApiOperation("分页查询用户的成交订单")
    public R<Page<TurnoverOrder>> findByPage(Page<TurnoverOrder> page, String symbol, Integer type) {
        Long userId = Long.valueOf(SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString());
        Page<TurnoverOrder>  pageData = turnoverOrderService.findByPage(page,userId,symbol,type);
        return R.ok(pageData);
    }


}
